/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import exception.DuplicateConstraintException;
import exception.ExceptionInterceptor;
import exception.RemoveConstraintException;
import java.io.Serializable;
import java.util.List;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.inject.Named;
import javax.interceptor.Interceptors;
import model.dao.LoteDao;
import model.entidades.Lote;

/**
 *
 * @author helton
 */
@Named
@Stateless
@Interceptors(ExceptionInterceptor.class)
public class LoteController implements Serializable {

    @Inject
    LoteDao loteDao;

    public Lote insert(Lote lote) throws DuplicateConstraintException {
        loteDao.insert(lote);
        return lote;
    }
    
    public Lote findLote(Lote lote){
        loteDao.findById(lote);
        return lote;
    }
    
    public List<Lote> getAll(){
        return loteDao.getAll();
    }
}
